Application = Ext.extend(Ext.Panel,{
	fileGridPanel : null, // 文件类表
	fileTreePanel : null, // 树导航
	constructor : function(_cfg) {
		Ext.apply(this, _cfg);
		this.fileGridPanel = new FileGridPanel();
		this.fileTreePanel = new FileTreePanel();
		this.fileTreePanel.on('click', function(_node) 
		{
			this.fileGridPanel.listFiles(_node.id); // 左边树单击右边网格同步
		}, this);
		var tools = {
			id:'refresh', 
		 	handler: function(e, target, panel)
		 	{
				var rootNode = this.fileTreePanel.getRootNode();
				//判断要展开节点数据是否已加载。如果数据没加载,直接展开;否则，先load再展开
			   	if(rootNode.childrenRendered)
			   	{
			   		this.fileTreePanel.getLoader().load(rootNode);	
			   	}
			   	rootNode.expand(false, false);
		 	},
		 	qtip : "刷新",
			scope : this
		};
		Application.superclass.constructor.call(this, {
			layout : 'border',
			height: all_height,
			items : [
			   {
				title : '文件目录',
				region : 'west',
				layout : 'border',
				margins : '2 0 5 5',
				width : 275,
				minSize : 200,
				maxSize : 350,
				collapsible : true,
				split : true,
				items : [this.fileTreePanel, {
					region : 'south',
					title : '文件信息',
					autoScroll : true,
					collapsible : true,
					collapseMode:'mini',
					collapsed:true,
					split : true,
					margins : '-1',
					cmargins : '2 2 2 2',
					height : 220,
					html : '未开发...'
				}]
				,tools:[tools]
			}, {
				region : 'center',
				layout : 'card',
				margins : '2 5 5 0',
				activeItem : 0,
				border : false,
				items : [this.fileGridPanel]
			}]
		});
	}
});
Ext.onReady(function() 
{
	new Application({renderTo: "content"}).fileGridPanel.listFiles();
});
